package demo;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import io.pkts.packet.sip.SipMessage;


//public class SipEncoder extends MessageToByteEncoder {
//    @Override
//    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
//        out.writeBytes(msg.toString().getBytes());
//    }
//}


public class SipEncoder extends MessageToByteEncoder<SipMessage> {
    @Override
    protected void encode(ChannelHandlerContext ctx, SipMessage msg, ByteBuf out) throws Exception {
        out.writeBytes(msg.toBuffer().getArray());
    }
}